<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="选择项目类型" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		parent.ClosePop();
	}
	function doMutiSelect(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var arr=new Array();
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				arr.push(new Array(ob_arr[i].getAttribute("m_id"),ob_arr[i].getAttribute("m_nam"),ob_arr[i].getAttribute("wc_id"),ob_arr[i].getAttribute("wc_nam"),ob_arr[i].getAttribute("m_unit")));
			}
		}
		if(arr.length>0){
			parent.popRetVal=arr;
			parent.ClosePop();
		}else{
			ShowAlert('提示框','请选择项目类型！',200,100);
			return;
		}
	}
	function selectMakeType(index){
		var ob_arr = document.getElementsByName("query_checkbox");
		var arr=new Array();
		if ( ob_arr.length>=index ){
			var obj=ob_arr[index-1];
			arr[0]=new Array(obj.getAttribute("m_id"),obj.getAttribute("m_nam"),obj.getAttribute("wc_id"),obj.getAttribute("wc_nam"),obj.getAttribute("m_unit"));
			parent.popRetVal=arr;
		}
		parent.ClosePop();
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var arr=new Array();
		if(ob_arr.length>=it.getAttribute("index")){
			var obj=ob_arr[it.getAttribute("index")-1];
			arr[0]=new Array(obj.getAttribute("m_id"),obj.getAttribute("m_nam"),obj.getAttribute("wc_id"),obj.getAttribute("wc_nam"),obj.getAttribute("m_unit"));
			parent.popRetVal=arr;
		}
		parent.ClosePop();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		window.location="/base/MakeTypeListForMultiSelect.ihtm?search_key="+searchKey;
	}
	function doInit(){
		
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet">
<div class="sheet-main" id="bodyDiv" style="width:312px;">
  <div class="sheet-top">
    <div class="content">
      <h2>选择项目类型</h2>
      <p>选择要复制哪些项目类型的标准价格</p>
    </div>
  </div>
  <div class="content">		
	<div align="right">
		<input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();" style="width:72px" value="<c:out value="${searchKey}" />">
		<input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();">
		<input type="button" class="buttom search-select" value=" 选 择" onClick="doMutiSelect();">
	 </div>
  </div>
  
	<div class="table-list" >
		<table width="100%">
			<tr>
				<th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th>
				<th width="20%">序号</th>
				<th width="60%">项目类型</th>
				<th width="20%">操作</th>
			</tr>
			<c:forEach var="item" items="${makeTypeList}" varStatus="i">
			<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
			<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
			<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' onmouseout='javascript:mouseout(this)' ondblclick='javascript:DoubleClick(this)' onmouseover='javascript:mouseover(this)' onClick='javascript:ClickCheck(this,true)'>
				<td>
	            	<input type="checkbox" onClick="javascript:ClickCheck(this,true);" name='query_checkbox' m_id="${item.id }" m_nam="<c:out value="${item.typeName}" />" m_unit="${item.unit}" wc_id="${item.workCenterId}" wc_nam="<commonTag:showSimpleObjectName list="${workCenterList}" objectId="${item.workCenterId}" />" />
	          	</td>
	          	<td style="text-align:left">${item.sequCode}</td>
				<td>${item.typeName }</td>
				<td>
					<a href="javascript:selectMakeType('${i.index+1}');">选择</a>
				</td>
			</tr>
			</c:forEach>
		</table> 
	  </div>	
</div>	
</body>
</html>